<!DOCTYPE html>
<html lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>新零售微店后台首页</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link th:href="@{/layui/css/layui.css}"  rel="stylesheet">
    <link th:href="@{/style/admin.css}"  rel="stylesheet">
    <style>
        .layui-table{overflow-y: scroll;}
        .layui-icon{
            margin-top: 0px;
            top:0px;
            right: 0px;
        }
    </style>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <!--<div class="layui-card layui-form" lay-filter="component-form-element">-->
            <!--<div class="layui-form-item">-->
                <!--<label class="layui-form-label">复选框</label>-->
                <!--<div class="layui-input-block">-->
                    <!--<input type="checkbox" name="like[write]" title="写作"><div class="layui-unselect layui-form-checkbox layui-form-checked"><span>写作</span><i class="layui-icon layui-icon-ok"></i></div>-->
                     <!--</div>-->
            <!--</div>-->
            <!--</div>-->
            <div class="layui-form-item">
                <div class="layui-inline">
                    <form name="form" class="form">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-block">
                            <div class="layui-input-inline">
                                <select name="supp" id="supp"  lay-verify="required"   lay-filter="select1">

                                </select>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="layui-inline">
                    <input style="top:0px;right: 0px;margin-top: 0px;" type="checkbox" id="newpr" name="like[write]" title="是否新品">
                    <!--<div class="layui-unselect layui-form-checkbox layui-form-checked">-->
                        <!--<span>写作</span>-->
                        <!--<i class="layui-icon layui-icon-ok"></i>-->
                    <!--</div>-->
                </div>

                <div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search" onclick="SelectData()">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                    <!--<button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search" onclick="qingkong()">-->
                        <!--<i class="layuiadmin-button-btn">清空条件</i>-->
                    <!--</button>-->
                </div>
            </div>


        </div>

        <div class="layui-card-body">
            <!--<div style="padding-bottom: 10px;">-->

                <!--<button class="layui-btn layuiadmin-btn-admin" data-type="batchdel">删除</button>-->
                <!--<button class="layui-btn layuiadmin-btn-admin" data-type="add" onclick="WinOpenAdd();">添加</button>-->
            <!--</div>-->
            <table class="layui-hide" id="test" lay-filter="test"></table>
            <!--<table class="layui-table" lay-data="{url:'/getProductSales', id:'test3',page: true,limit:15,id: 'testReload'}" lay-filter="test3">-->
                <!--<thead>-->
                <!--<tr>-->
                    <!--<th lay-data="{type:'numbers'}">序号</th>-->
                    <!--&lt;!&ndash;<th lay-data="{type:'checkbox'}">ID</th>&ndash;&gt;-->
                    <!--<th lay-data="{field:'productName', width:180}">产品名称</th>-->
                    <!--<th lay-data="{field:'guigeName', width:180}">规格名称</th>-->
                    <!--<th lay-data="{field:'m1', width:60}">一月</th>-->
                    <!--<th lay-data="{field:'m2', width:60}">二月</th>-->
                    <!--<th lay-data="{field:'m3', width:60}">三月</th>-->
                    <!--<th lay-data="{field:'m4', width:60}">四月</th>-->
                    <!--<th lay-data="{field:'m5', width:60}">五月</th>-->
                    <!--<th lay-data="{field:'m6', width:60}">六月</th>-->
                    <!--<th lay-data="{field:'m7', width:60}">七月</th>-->
                    <!--<th lay-data="{field:'m8', width:60}">八月</th>-->
                    <!--<th lay-data="{field:'m9', width:60}">九月</th>-->
                    <!--<th lay-data="{field:'m10', width:60}">十月</th>-->
                    <!--<th lay-data="{field:'m11', width:80}">十一月</th>-->
                    <!--<th lay-data="{field:'m12', width:80}">十二月</th>-->
                    <!--<th lay-data="{field:'allCount', width:80}">总数量</th>-->
                <!--</tr>-->

                <!--</thead>-->
            <!--</table>-->


        </div>
    </div>
</div>

<script th:src="@{/layui/jquery.min.js}"></script>
<script th:src="@{/layui/layui.js}"></script>
<script th:src="@{/js/productsales.js}"></script>
<script type="application/javascript">
    $(function () {
        getSupplier();
    });
    function qingkong() {

    }
    var form;
    layui.use('form', function () {
        form = layui.form;
        form.on('select(select1)', function (data) {
            var ststus1 = data.elem[data.elem.selectedIndex].text;
var valw=data.value;
if(valw==0){
    ststus1='';
}
            selectAll(ststus1,"");
        });
        form.render();
    });
    function selectAll(status1,status2) {
        //执行重载
        table.reload('testReload', {
            url:"/getProductSales?supplier="+status1+"&newpr="+status2,
            page: {
                curr: 1
            }
        });
    }

    function SelectData() {
        // keywords = $("#keywords").val();
        // userNo=$("#userNo").val();
        var text=$("#newpr").is(":checked");
        layui.use('form', function () {
            // form = layui.form;
            // form.on('select(select1)', function (data) {
            //     ststus1 = data.value;
            //     selectAll(ststus1, ststus2, ststus3, keywords,userNo);
            // });
            // form.render();
            //
            var ststus2="null";
            if(text){
                ststus2="贵州荟生生物科技有限公司";
            }
            selectAll('', ststus2);
            form.render();

        });
    }

    function getSupplier() {
        var su="<option selected='selected' value='0'>供应商信息</option>";
        $.ajax({
            url: '/selectSupplier',
            type: 'post',
            dataType: 'json',
            async: false,
            success: function(data){

                $.each(data.supplier, function(i, item) {
                    var sd=100+i;
                    su +="<option value='"+sd+"'>"+item.supplier+"</option>";
                })
                $("#supp").append(su);
            }
        });
    }
</script>

</body>
</html>

